package cn.net.gemai.springboot_quartz.jobs;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 定时任务方案二
 * 直接实现Job的execute方法
 */
public class ConsoleJob2 implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        /**
         * 执行的业务逻辑
         * 这里简单打印当前的时间
         */
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dateString=sdf.format(new Date());
        System.out.println("当前服务器时间是:" + dateString);
    }
}
